package com.zc.security.controller;

import com.zc.security.dto.UserDto;
import com.zc.security.service.UserService;
import com.zc.security.utils.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserLoginController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public ResponseData<String> login(@RequestBody UserDto userDto) {
        return userService.login(userDto);
    }

    @PostMapping("/logout")
    public ResponseData<String> logout() {
        return userService.logout();
    }
}
